/// 解析基类
class BaseBeanEntity<T> {
  bool success;
  String message;
  Map<String, dynamic> data;
  List<dynamic> dataList;

  BaseBeanEntity({this.success, this.data, this.dataList});

  /// 处理results为对象的情况
  BaseBeanEntity.fromJson(Map<String, dynamic> json) {
    success = json['success'];
    data = json['data'];
  }

  /// 处理results为数组的情况
  BaseBeanEntity.fromJsonList(Map<String, dynamic> json) {
    success = json['success'];
    dataList = json['data'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['error'] = this.success;
    if (this.data != null) {
      data['results'] = this.data;
    }
    return data;
  }
}